package com.sto.stoapp.http.request;

import com.google.gson.Gson;

public class BaseRequest {

	public BaseRequest() {

	}

	public String tid = "";
	public String trace = "";
	public String sessionId = "";
	public String mty = "";

	// 加数据头
	protected String build(String text) {
		if (text.length() >= 6) {
			return text.substring(0, 6);
		} else {
			String s = "0";
			for (int i = 1; i < 6 - text.length(); i++) {
				s = s + "0";
			}
			return s + text;
		}
	}

	public String buildToRequestString() {
		Gson gson = new Gson();
		String str = gson.toJson(this);
		return build(str.length() + "") + str;

	};

}
